package com.stox.ui.javafx.core.widget.wrapper;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import javafx.scene.image.Image;

import org.springframework.util.StringUtils;

import com.stox.util.PathUtil;

public class ImageView extends javafx.scene.image.ImageView {

	private static String basePath = PathUtil.getRootPath()+"resource"+File.separator+"image"+File.separator;
	
	public ImageView() {
		super();
		setSmooth(true);
		setPreserveRatio(true);
	}
	
	public ImageView(Image arg0) {
		super(arg0);
		setSmooth(true);
		setPreserveRatio(true);
	}

	public ImageView(String path) {
		super();
		setSmooth(true);
		setPreserveRatio(true);
		if(StringUtils.hasText(path)) {
			try {
				setImage(new Image(new FileInputStream(basePath+path), 20,20,true,true));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}
	}
	
}
